package com.qf.springmvc02.controller;

import com.qf.springmvc02.entity.User;
import org.springframework.web.bind.annotation.*;

/**
 * @author nk
 * @date 2022/5/4 16:01
 */
@RestController("jsonController")
@RequestMapping("/json")
public class JsonController {
    @RequestMapping(value = "test1",method = RequestMethod.GET)
    public User test1(){
        User user = new User();
        user.setName("加贝");
        user.setPassword("123456");
        return user;
    }
    @GetMapping("/test2")
    public User test2(){
        User user = new User();
        user.setName("加贝");
        user.setPassword("123456");
        return user;
    }
    @GetMapping({"test3","test4"})
    public User test3(){
        User user = new User();
        user.setName("加贝");
        user.setPassword("123456");
        return user;
    }
    @RequestMapping(value = "test5",produces = "text/html;charset=utf-8")
    public String test5(){
        return "飞飞飞飞飞";
    }
    @RequestMapping(value = "test6")
    public User test6(@RequestBody User user){
        System.out.println(user);
        return user;
    }
}
